<?php

$db = require __DIR__ . '/db.php';
$redis = require __DIR__ . '/redis.php';
$elasticsearch = require __DIR__ . '/elasticsearch.php';

$config = [
    'timeZone' => 'Asia/Shanghai',
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm' => '@vendor/npm-asset',
    ],
    'language' => 'zh-CN', //中文语言包
    'bootstrap' => [
        'queueSpiderTb', //采集队列
        'queueImportCloud', //入库队列
        'queueCopyDy',//复制到抖音店铺
        'queueCopyTb',//复制到淘宝店铺
    ],
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        //采集队列
        'queueSpiderTb' => [
            'class' => \yii\queue\redis\Queue::class,
            'as log' => \yii\queue\LogBehavior::class,
            // 连接组件或它的配置
            'redis' => 'redis',
            // Queue channel key
            'channel' => 'queueSpiderTb',
        ],
        //入云商品库队列
        'queueImportCloud' => [
            'class' => \yii\queue\redis\Queue::class,
            'as log' => \yii\queue\LogBehavior::class,
            // 连接组件或它的配置
            'redis' => 'redis',
            'channel' => 'queueImportCloud',
        ],
        //复制商品到抖音店铺
        'queueCopyDy' => [
            'class' => \yii\queue\redis\Queue::class,
            'as log' => \yii\queue\LogBehavior::class,
            // 连接组件或它的配置
            'redis' => 'redis',
            'channel' => 'queueCopyDy',
        ],
        //复制到淘宝店铺
        'queueCopyTb' => [
            'class' => \yii\queue\redis\Queue::class,
            'as log' => \yii\queue\LogBehavior::class,
            'redis' => 'redis',
            'channel' => 'queueCopyTb',
        ],
        'db' => $db,
        'redis' => $redis,
        'elasticsearch' => [
            'class' => 'common\components\system\ES',
            //集群方式连接
            'hosts' => $elasticsearch,
            'retry' => 2,
        ],
    ],
];

return $config;
